# Maintainer: Guillaume ALAUX <guillaume@archlinux.org>

pkgname=antlr4
_shortname=${pkgname:0:-1}
pkgver=4.13.1
pkgrel=1
pkgdesc='Parser generator for reading, processing, executing, or translating structured text or binary files'
arch=('any')
url='https://www.antlr.org/index.html'
license=('BSD')
depends=('bash' 'java-environment>=6')
provides=("antlr=${pkgver}")
source=(https://www.antlr.org/download/${_shortname}-${pkgver}-complete.jar
        ${pkgname}-LICENSE.txt::https://raw.githubusercontent.com/${_shortname}/${pkgname}/master/LICENSE.txt
        bin_antlr4
        bin_grun)
noextract=("${_shortname}-${pkgver}-complete.jar")
sha256sums=('bc13a9c57a8dd7d5196888211e5ede657cb64a3ce968608697e4f668251a8487'
            '3db1fb3ee79a4b4f9918fc4d0f6133bf18a3cf787f126cd22f8aa9b862281c0c'
            '345697e77b7191e2afe70b223f205a8a7fd18a655e6865f503a764583d9a3dcc'
            '81e1536e011762287a095e969784a9f2fbbcc62374ab5fb83e19e01ade20b454')

package() {
  cd "${srcdir}"
  install -D ${_shortname}-${pkgver}-complete.jar \
             "${pkgdir}"/usr/share/java/${_shortname}-${pkgver}-complete.jar
  ln -s antlr-${pkgver}-complete.jar "${pkgdir}"/usr/share/java/antlr-complete.jar
  install -D bin_antlr4 "${pkgdir}"/usr/bin/antlr4
  install -D bin_grun   "${pkgdir}"/usr/bin/grun
  install -D ${pkgname}-LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE.txt
}
